/*
 * @Author: Villlee 15388605742@163.com
 * @Date: 2025-08-19 00:29:15
 * @LastEditors: Villlee 15388605742@163.com
 * @LastEditTime: 2025-08-19 00:31:32
 * @FilePath: /node-react-vite/frontend/src/pages/Login/Test/index.tsx
 * @Description:
 *
 * Copyright (c) 2025 by ${git_name_email}, All Rights Reserved.
 */
// 在 React 组件中
import { Button, message } from "antd";
import { useState } from "react";

export default function Test() {
  const [data, setData] = useState("");

  const fetchData = async () => {
    const res = await fetch("http://localhost:7001/api"); // 后端地址
    const json = await res.json();
    setData(json.message);
    message.success("请求成功！");
  };

  return (
    <div>
      <Button type="primary" onClick={fetchData}>
        调用后端 API
      </Button>
      <div>{data}</div>
    </div>
  );
}
